﻿@model StartStop.ServiceResources.UserSettings
@{
    ViewBag.Title = "ManageAccount";
}
<div id="hero-wrap">
    <div id="hero" class="profile section group">
        <div id="user-profile" class="group">
            @if (Request.IsAuthenticated)
            {
                <text> <a href="/Image/Upload/avatar/">
                </text>
            }
            else
            {
                <text>
                </text>
            }
            <img src="@Url.Content(ViewBag.MediumAvatar)" alt="" /> </a>
            <p>
                Username: <span>@ViewBag.UserGen.Username</span>
            </p>
            <p>
                Member since: <span>@String.Format("{0:dd/MM/yyyy}", ViewBag.UserGen.Joined)</span>
            </p>
        </div>
        <!-- /user-profile -->
        <ul id="user-stats">
            <li id="trophies">Trophies <span>@ViewBag.UserGen.TrophyCount</span></li>
            <li id="friends">Friends <span>@ViewBag.UserGen.NumberOfFriends</span></li>
            <li id="level">Level <span>@ViewBag.UserGen.CurrentLevel</span></li>
        </ul>
        <!-- /user-stats -->
    </div>
    <!-- /hero -->
</div>
<!-- /hero-wrap -->
<div id="profile" class="section group">
    <div id="bc">
        You are here: <a href="/">Home</a> <a href="/Stats/User/@ViewBag.UserGen.Username">@ViewBag.UserGen.Username</a>
        <a href="#">Manage your account</a>
    </div>
    <!-- /breadcrumb -->
    <div id="generic-wrap">
        <h1>
            Manage Your Account</h1>
        <p>
        </p>
        @using (Html.BeginForm("ManageAccount", "Account", FormMethod.Post))
        {
             
            @Html.HiddenFor(x => x.UserID, "value") 
            
            <table class="tbl" cellspacing="0">
                <tr>
                    <th>
                        Preference
                    </th>
                    <th>
                        Setting
                    </th>
                </tr>
                @if (Model != null)
                {
                    for (var i = 0; i < Model.Settings.Count; i++)
                    {
                    <tr>
                        <td>@Model.Settings[i].PreferenceName
                        </td>
                        <td>
                            @if (Model.Settings[i].PreferenceType == 2)
                            {
                                @Html.CheckBoxFor(x => x.Settings[i].PreferenceBool)
                                @Html.HiddenFor(x => x.Settings[i].PreferenceName, "value")
                                @Html.HiddenFor(x => x.Settings[i].PreferenceType, "2")
                            }
                            @if (Model.Settings[i].PreferenceType == 1)
                            {
                                @Html.TextBoxFor(x => x.Settings[i].PreferenceString)
                                @Html.HiddenFor(x => x.Settings[i].PreferenceName, "value")
                                @Html.HiddenFor(x => x.Settings[i].PreferenceType, "1")
                            }
                        </td>
                    </tr>
                    }
                }
            </table>

            <input type="submit" value="Save Changes" class="action medium" />
        }
    </div>
    <!-- /generic-wrap -->
</div>
<!-- /profile-wrap -->
